Dev_Tasks
Communications Request (COMMREQ) ladder logic instructions instructs the PROFIBUS Master to gather diagnostic or status data and report it to the PLC CPU.
Reference: Series 90-30 PROFIBUS Master Module User's Manual GFK-2121
#END#

Get Slave Status
The Get Slave Status Command retrieves detailed status information for the specified device.
#END#

Get Master Status
The Get Master Status Command provides detailed status information about the Master module.
#END#

Get Device Diagnostics
The Get Device Diagnostic command retrieves detailed status information for the specified device.
#END#

Read Module Header
The Read Module Header command retrieves Network Diagnostic Information and statistics from the Device.
#END#

Clear Counters
The Clear Counters Command clears the counters in the PROFIBUS Master module to zero.
#END#


Wait_Flag	
PROFIBUS COMMREQs ARE ALWAYS NO WAIT MODE. This flag determines whether PLC will wait until the device serial ports receive the intended data before continuing. The request can either send a message and wait for a reply, or send a message and continue without waiting for a reply. If the Command Block specifies that the program will not wait for a reply, the Command Block contents are sent to the device and ladder program execution resumes immediately. This is referred to as NOWAIT mode. If the Command Block specifies that the program will wait for a reply, the Command Block contents are sent to the targeted device and the CPU waits for a reply for a maximum length of time specified in the Command Block. If the device does not respond in that time, ladder program execution resumes. This is referred to as WAIT mode.
#END#

Idle_Tmout	
The idle timeout value is the maximum time the PLC waits for the device to acknowledge receipt of the request. For NOWAIT, this value is not used. (Any timeout value is ignored; it can be zero.) If WAIT is selected, this word specifies the idle timeout period, in 100-microsecond increments.
#END# 

Max_Comm_Tm	
This word contains the maximum amount of time the program should hold the window open when the device is busy. For NOWAIT, this value is not used. (Any timeout value is ignored; it can be zero.) If WAIT is selected, this word specifies the maximum time in 100 microsecond increments.
#END#

Profibus_Task_Id
Always 1
#END#

Memory_Type_Device_Status
This and next word specify the location in the PLC where the response will be written.
Response written to location specified by this and next word:
Word 		Name 				Description
Word 1 		Command Code 			Echo of Command code that this data block is replying to (0x0001).
Word 2 		StatusCode/Extended Status Code	Code indicating the status of the client connection to the device. See below:
						00h Slave Ok.
						01h Failure while trying to configure slave. Check table below for extended Status Code.
						02h Slave real ID does not match slaves configured ID.
						03h Frame delivery problem while updating slave data. Check following tables for Extended Status Codes.
						04h Frame delivery problem while reading slave diagnostics.
						05h Error in diagnostic status byte #1 during configure.
						06h Error in diagnostic status byte #2 during configure.
						07h Error in diagnostic status byte #1 during diagnostic read.
						08h Error in diagnostic status byte #2 during diagnostic read.
						09h Station address from diagnostic read does not match.
						0Ah Timeout waiting for IO update.
						0Bh Warning: Slave watchdog is not enabled.
	Note: If the Status code is 01 or 03, the upper byte must be interpreted using the below Extended Status tables (2 tables 1 each for 01 and 03 status codes)

Word 39 	Reserved for future use. 		Word 10 of the Get Device Status command block should specify a minimum of 9 words to accommodate 								possible future use of this space.

Get Device Status Code 01h Extended Status Codes - High Byte of Word 2
Status 	Meaning
00h 	No Extended codes available.
01h 	No response or NAK (not acknowledged) after sending the first diagnostic status request to the slave.
02h 	No response or NAK after sending parameter data to the slave.
03h 	No response or NAK after sending configuration check data to the slave.
04h 	No response or NAK after sending the second diagnostic status request to the slave.
05h 	Invalid response after sending the first diagnostic status request to the slave.
06h 	Invalid response after sending parameter data to the slave. 
07h 	Invalid response after sending configuration check data to the slave.
08h 	Response to configuration check packet was non-zero length(slave should never return anything).
09h 	Invalid response after sending the second diagnostic status request to the slave.

Get Device Status Code 03h Extended Status Codes - High Byte of Word 2
Status 	Meaning
0Ah 	Error in data update during configuration.
0Bh 	No response or NAK when updating data while online.
#END#

Memory_Address
This and previous word specify the location in the PLC where the response will be written. The value entered is the offset (0-based) from the beginning of PLC memory for the memory type and mode specified in previous parameter. This offset will be either in bits, bytes, or words depending on the mode specified (for example, if previous parameter = %I and this parameter = 2, then the starting address will be %I9). Valid ranges of values depend on the PLCs memory ranges.
#END#

Max_Size_Of_Response_Area
Max_Size_Of_Response_Area specifies the size of the memory block for the response. The COMMREQ has built-in future expansion space in the response field. The Response Memory Size (including the future expansion space) is 9 words. In the current version of firmware 1.12, the response size is 2 words and only 2 words are written to memory. The user is responsible for assuring that this area is large enough to contain the requested data without overwriting other application data. The user is responsible for assuring that this area is large enough to contain the requested data without overwriting other application data. It is recommended that the future expansion space be allocated initially, to avoid problems if future firmware upgrades use more than 2 words for the response.
#END#

Slave_Number
Slave_Number specifies the address of the device the COMMREQ is retrieving device status from. If the address of the master, or a slave which is not, on the bus is entered a COMMREQ Status Word response of 4 will be returned. Range: 0 to 125.
#END#

Memory_Type_Master_Status
This and next word specify the location in the PLC where the response will be written.
Response written to location specified by this and next word:
Word 		Name 			Description
Word 1 		Command Code 		Echo of Command code that this data block is replying to. (0x0002)
Word 2 		Status Code 		Code indicating the status of the Master module. See tables below for meaning of the code
					Get Master Status Network Parameter Errors
					The following status errors may occur when you set the network parameters. Values are in hexadecimal.
						Status 	Meaning
						00h 	No error
						01h 	Bad command
						02h 	Bad baud rate
						03h 	Bad station address
						04h 	Bad high station address
						05h 	Bad token rotation time
						06h 	Bad slot time
						07h 	Bad idle time 1
						08h 	Bad idle time 2
						09h 	Bad ready time
						0Ah 	Bad quiet time
						0Bh 	Bad gap update time
						0Ch 	Bad token retry
						0Dh 	Bad message retry
						0Eh 	Bad token error limit
						0Fh 	Bad response error limit
						10h 	Baud detect error
					Get Master Status Configuration Errors
					The following errors may occur when you configure the Master through the init file generated by the configuration tool.
						Status 	Meaning
						20h 	Bad check pattern
						21h 	Binary configuration too short
						22h 	Binary configuration too long
						23h 	Bad checksum
						24h 	Invalid CPU header
						25h 	Invalid slave Rx type
						26h 	Rx overflow
						27h 	Tx overflow
						28h 	Master extended allocation error
						29h 	Invalid Configuration Fileformat
						2Ah 	Parse Configuration file error
						2Bh 	Failed to go online
					Get Master Status Flash Programming Errors
					The following errors may occur when you program flash memory.
						Status 	Meaning
						30h 	No configuration
						31h 	Bad ID
						32h 	Erase error
						33h 	Programming error
						34h 	Verification error
						35h 	Timeout waiting for IO update
						36h 	Warning: Slave watchdog is not enabled
					Get Master Status Fatal Errors
					The following are fatal errors. The module must be reset to resume operation.
						Status 	Meaning
						80h 	Internal error
						81h 	Out of Data Structure Buffers
						82h 	Host Watchdog byte
						83h 	Heap allocation failure
						84h 	Shared heap allocation failure

Words 3-9 	Reserved for future use 	Word 10 of the Get Master Status command block should specify a minimum of 9 words to accommodate possible future 						use of this space.
#END#

Memory_Type_Device_Diagnostics
This and next word specify the location in the PLC where the response will be written.
Response written to location specified by this and next word:
Word 	Name 			Type 	Description
Word 1 	Command Code 		UINT2 	Command code that this data block is replying to (0x0004)
Word 2 	Size of Diagnostics 	UINT2 	The size of the data. If it is greater than the memory area specified in word 10 of the Get Device Diagnostics command 						block, the COMMREQ will fail, returning a 7 in the COMMREQ Status Word.
Word 3 	Diagnostics 		BYTE 	The diagnostics of the given slave.
#END#

Memory_Type_Read_Header
This and next word specify the location in the PLC where the response will be written.
Read Module Header Reply Data Format for Master written to location specified by this and next word:
Word 		Name 			Description
Word 1 		Command Code 		Echo of Command Code that this data block is replying to (0x0005)
Word 2 		ModuleType 		A value of 2 indicates the module is a Master. Contains 1 if the module is a Slave.
Word 3 		PfbStatus 		PROFIBUS Status register, also can be read using the Get Master Status COMMREQ.
Word 4 		ModuleVersion 		Module firmware version 0112h = 1.12
Word 5 		ErrLanOffline 		Counter. LAN went offline due to errors.
Word 6 		DiagConf 		Total confirmations
Word 7 		DiagInd 			Total indications
Word 8 		ErrNotOk			Total not OK confirmations and indications
Word 9,10 	DiagTokHldTime 		Instantaneous token hold time
Word 11,12 	DiagMinTokHldTime 	Minimum token hold time
Word 13 		DiagMasterUpdate 		Master I/O update cycles completed
Word 14 		ErrMasErr 		Master->DP slave errors
Word 15 		ErrMasReConfig 		Master->DP went offline and had to be reconfigured
Word 16,17 	DiagMasScanTime 	Master scan time(s)
Word 18,19 	DiagMasMaxScanTime 	Maximum master scan time(s)
Word 20 		ErrInvReqLen 		Invalid request length error counter
Word 21 		ErrFifo 			FIFO overflow error counter
Word 22 		ErrRxOverun 		Receive overrun error counter
Word 23 		ErrDblTok 		Double token error counter
Word 24 		ErrRespErr 		Response error counter
Word 25 		ErrSynErr 		General network error counter
Word 26 		ErrNetTout 		Network timeout error counter
Word 27 		ErrHsa 			Station higher than HighestAddressedStation was heard counter
Word 28 		ErrStn 			Duplicate station detected counter
Word 29 		ErrPasTok 		Unable to pass token counter
Word 30 		ErrLasBad 		Active station list is invalid
Word 31 		ErrInternal 		Internal errors
Word 32 		ErrArg 			Argument errors
Word 33 		ErrEventOverun 		A new event occurred before the last one was cleared
Note: If the Name starts with Err, the value stops at the maximum. If the Name starts with Diag the count rolls over to zero.
#END#

Max_Size_Of_Response_Area_RH
Response Memory Size specifies the size of the memory block for the response. The Response Memory Size is 33 words. If the Response Memory Size is set smaller than 33, the COMMREQ will fail with a 7 in the COMMREQ Status Word. The user is responsible for assuring that this area is large enough to contain the requested data without overwriting other application data.
#END#

Memory_Type_Clear_Counters
This and next word specify the location in the PLC where the response will be written. 
Clear Counters Reply Data Format written to location specified by this and next word:
Word 		Name 		Description
Word 1 		Command Code 	Echo of Command code that this data block is replying to. (0x0006)
Word 2 		Status Code 	Reports 1 for success and 0 for failure.
#END#

Max_Size_Of_Response_Area_CC
Response Memory Size specifies the size of the memory block for the response. The Response Memory Size is 2 words. If the Response Memory Size (word 10 in the
Clear Counters command block) is set greater than 2, the COMMREQ will succeed. The unneeded memory locations are not written.
#END#
